{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\gwcox\Desktop\jop replication materials\minrolls.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}20 Oct 2022, 12:36:01

{com}. do "C:\Users\gwcox\Desktop\jop replication materials\minrolls.do"
{txt}
{com}. *division-specific variables
. egen nCyes = sum((vote==1)*(party2s=="C")),by(divid)
{txt}
{com}. egen nCno = sum((vote==0)*(party2s=="C")),by(divid)
{txt}
{com}. egen nLyes = sum((vote==1)*(party2s=="L")),by(divid)
{txt}
{com}. egen nLno = sum((vote==0)*(party2s=="L")),by(divid)
{txt}
{com}. label var nCyes "n of yes votes cast by C party in this division"
{txt}
{com}. label var nLyes "n of yes votes cast by L party in this division"
{txt}
{com}. 
. gen Cvote=((nCyes>nCno))
{txt}
{com}. gen Lvote=((nLyes>nLno))
{txt}
{com}. 
. *egen Ayes = sum((vote==1)),by(divid)
. *egen Noes = sum((vote==0)),by(divid)
. 
. *gen partyvote = ((nCyes>nCno&nLyes<nLno)|(nCyes<nCno&nLyes>nLno))
. *label var partyvote "= ((nCyes>nCno&nLyes<nLno)|(nCyes<nCno&nLyes>nLno))"
. 
. 
. * minority rolls
. sort parl_n divid mpid
{txt}
{com}. gen minority_roll=0 if partyvote==1
{txt}(4,395,510 missing values generated)

{com}. replace minority_roll=1 if majparty=="L"&partyvote==1&Lvote==1&Ayes>Noes 
{txt}(1,426,276 real changes made)

{com}. replace minority_roll=1 if majparty=="C"&partyvote==1&Cvote==1&Ayes>Noes 
{txt}(2,701,185 real changes made)

{com}. 
. egen nmajbills = sum(divid!=divid[_n-1]&((majparty=="L"&Lvote==1)|(majparty=="C"&Cvote==1))&passage==1),by(parl_n)
{txt}
{com}. egen nbillsopp = sum(divid!=divid[_n-1]&((majparty=="L"&Lvote==1)|(majparty=="C"&Cvote==1))&passage==1&((majparty=="L"&Cvote==0)|(majparty=="C"&Lvote==0))),by(parl_n)
{txt}
{com}. egen nminroll2 = sum(divid!=divid[_n-1]&minority_roll==1&passage==1),by(parl_n)
{txt}
{com}. gen pctminroll2 = nminroll2/nmajbills
{txt}
{com}. gen pctbillopp = nbillsopp/nmajbills
{txt}
{com}. label var nmajbills "n of bill passage motions on which majority wants yes in this parl_n"
{txt}
{com}. label var nbillsopp "n of majority's bill passage motions opposed"
{txt}
{com}. label var nminroll2 "n of minority rolls on bill passage motions in this parl_n"
{txt}
{com}. 
. * Figure 2
. gen gap = pctbillopp - pctminroll2
{txt}
{com}. 
. sc pctminroll2 parl_s if parl_n!=parl_n[_n-1],c(L) msym(S) || sc pctbillopp parl_s if parl_n!=parl_n[_n-1],c(L) msym(D) legend(order(2 "Minority opposition rate" - 1 "Minority roll rate" -  3 "Smoothed gap")) ytitle("Share of bill passage motions") xtitle("Year parliament elected") || lowess gap parl_s if parl_n!=parl_n[_n-1],bwidth(.4)
{res}{txt}
{com}. 
. 
{txt}end of do-file

{com}. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\gwcox\Desktop\jop replication materials\minrolls.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}20 Oct 2022, 12:37:18
{txt}{.-}
{smcl}
{txt}{sf}{ul off}